package com.plat.sdk.okgo.net;


import android.app.Application;
import android.util.Log;

import com.lzy.okgo.OkGo;
import com.lzy.okgo.cookie.CookieJarImpl;
import com.lzy.okgo.cookie.store.SPCookieStore;
import com.plat.sdk.okgo.callbck.JsonCallback;

import java.util.Map;

import okhttp3.OkHttpClient;


/**
 * Created by ccb on 2017/10/12.
 * 网络框架二次封装
 */

public class OKUtils {

    /**
     * get 请求接口基类
     *
     * @param url
     * @param tag
     * @param map
     * @param callback
     * @param <Bean>
     */
    public static <Bean> void getRequest(String url, Object tag, Map<String, String> map, JsonCallback<Bean> callback) {
        Log.d("OkGoUtil", "method get");
        OkGo.<Bean>get(url)
                .tag(tag)
                .params(map)
                .execute(callback);
    }

    /**
     * post 请求接口基类
     *
     * @param url
     * @param tag
     * @param map
     * @param callback
     * @param <Bean>
     */
    public static <Bean> void postRequest(String url, Object tag, Map<String, String> map, JsonCallback<Bean> callback) {
        Log.d("OkGoUtil", "method post");
        OkGo.<Bean>post(url)
                .tag(tag)
                .params(map)
                .execute(callback);
    }

}
